<template>
    <div>
        <div class="crumbs">
            <div class="contentbox">
                <div class="contentsize">租金管理-对账查看</div>
                <div>
                    <el-button @click="cacelsubmitForm('ruleForm')">返回</el-button>

                </div>
            </div>
        </div>
        <div class="container">
            <el-table :data="tableData" style="width: 100%" :header-cell-style="tableHeaderColor" :row-style="tablerowColor" border>
                <el-table-column prop="jllx" label="记录类型" align="center" fixed>
                    <template slot-scope="scope">
                        {{ scope.row.jllx=='1' ?'正常租金': scope.row.jllx=='2'?'补旧欠':''}}
                    </template>
                </el-table-column>
                <el-table-column prop="czr" label="承租单位" align="center"> </el-table-column>
                <el-table-column prop="dabh" label="档案编号" align="center"> </el-table-column>
                <el-table-column prop="jkje" label="交款金额" align="center"> </el-table-column>
                <el-table-column prop="year" label="年份" align="center"> </el-table-column>
                <el-table-column prop="month" label="月份" align="center"> </el-table-column>
                <el-table-column prop="jmje" label="减免金额" align="center" width="100"> </el-table-column>
                <el-table-column prop="yjje" label="应缴金额" align="center"> </el-table-column>
            </el-table>
            <!-- <div class="pagination" style="float: right">
                <el-pagination background layout="total,prev, pager, next,jumper" :total="total" :current-page.sync="current"
                    :page-size="pageSize" @current-change="handleCurrentChange">
                </el-pagination>
            </div> -->
        </div>
    </div>
</template>

<script>
import { dzdetail, projectdelete } from '@/api/index';
import valueList from '@/components/common/valueList.vue'
export default {
    name: 'dzdetail',
    data() {
        return {
            sjztlist: valueList.sjztlist,//数据状态
            total: 0,
            current: 1,
            pageSize: 10,
            form: {
                cb: '',//产别 ,
                cqdw: '',//产权单位 ,
                create_name: '',//创建人 ,
                create_name_id: '',//创建人id ,
                create_time: '',//创建时间 ,
                current: 1,//第几页 ,
                czr: '',//承租人 ,
                dabh: '',//档案编号 ,
                dqje: '',//当欠金额 ,
                dqsj: '',//合同到期时间 ,
                fwdz: '',//地址 ,
                id: '',//id ,
                jzmj: '',//建筑面积 ,
                pageSize: 10,//每页数量 ,
                qs: '',//区属 ,
                signid: '',//signid ,
                status_code: '1',//1正常 2删除 ,
                type: this.$store.getters.type,//分类 1:房屋 2：楼栋 ,
                update_name: '',//修改人 ,
                update_name_id: '',//修改人id ,
                update_time: '',//修改时间 ,
                ysje: '',//预收金额 ,
                yzj: '',//月租金
            },
            tableData: [],
            multipleSelection: [],//预转已选中列表
        };
    },
    components: {},
    computed: {
        // 判断变色
        getcolorred(htzt) {
            console.log(htzt);
            return (htzt) => {
                if (htzt == "正常") {
                    return { color: "#19BE6B", fontWeight: 700 };
                } else if (htzt == '已经到期') {
                    return { color: "#D9001B", fontWeight: 700 };
                } else if (htzt == '即将到期') {
                    return { color: "#FF9900", fontWeight: 700 };
                } else if (htzt == '未签合同') {
                    return { color: "#409ee1", fontWeight: 700 };
                }
            };
        },
    },
    methods: {
        // 列表样式
        tableHeaderColor({ row, column, rowIndex, columnIndex }) {
            if (rowIndex === 0) {
                return 'background-color: #f7f7f7;color:black;height: 54px;font-weight: 500;font-size:14px;font-variant:tabular-nums'
            }
        },
        tablerowColor({ row, rowIndex }) {
            return 'height: 42px;font-size:14px;'
        },
        // 换页
        handleCurrentChange(val) {
            this.current = val;
            this.form.current = val;
            this.dzdetail(this.form);
            console.log(val);
        },
        // 搜索
        onSearch() {
            this.current = 1;
            this.form.current = 1;
            this.dzdetail(this.form);
            console.log('搜索');
        },
        // 添加
        addnew() {
            this.$router.push({
                name: 'addproject',
                path: '/addproject'
            });
        },
        // 删除
        deleteClick(e) {
            console.log(e);
            this.$confirm('确定删除此条信息吗？')
                .then(() => {
                    let data = { id: e.id };
                    projectdelete(data).then((res) => {
                        if (res.code == 200) {
                            this.dzdetail(this.form);
                            this.$message.success('删除成功');
                        }
                    });
                })
                .catch(() => {
                    this.$message.success('删除取消');
                });
        },
        // 项目列表
        dzdetail(data) {
            dzdetail(data).then((res) => {
                if (res.code == 200) {
                    this.tableData = res.data;
                    // this.total = res.data.total;
                } else {
                    // this.tableData = [];
                    // this.total = 0;
                }
            });
        },
        // 多条预转已点击事件
        handleSelectionChange(val) {
            console.log('val', val)
            this.multipleSelection = val;
        },
        // 取消
        cacelsubmitForm() {
            this.$router.go(-1);
        },
    },
    mounted() {
        let data=this.$route.params.id
        this.dzdetail(data);
    }
};
</script>

<style scoped>
.container {
    overflow: hidden;
}

.crumbs {
    background-color: #fff;
    padding: 20px 20px;
}

.indexTitle {
    margin-bottom: 20px;
}
.contentbox {
    display: flex;
    justify-content: space-between;
}

.contentsize {
    font-size: 18px;
    font-weight: 700;
    line-height: 32px;
    color: #606266;
}

/* .contentsize {
    font-size: 18px;
    font-weight: 700;
} */

.handle-box {
    overflow: hidden;
}

/* 新增按钮 */
.addcolor {
    margin-bottom: 10px;
}
</style>
